package vip.xumy.picture.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

import vip.xumy.admin.verify.pojo.User;
import vip.xumy.picture.mapper.MyUserMapper;

/**	Do not use for any commercial purposes without permission
 *	@author: mengyxu
 *	@date: 2022年1月7日
 */

@Service
public class MyUserService {
	@Autowired
	private MyUserMapper userMapper;
	@Autowired
	private PictureService pictureService;
	
	public List<User> list() {
		return userMapper.list();
	}
	
	public void save(User user) {
		user.setPassword(DigestUtils.md5DigestAsHex(user.getPassword().getBytes()));
		userMapper.save(user);
	}
	
	public void delete(String id) {
		userMapper.delete(id);
		pictureService.deleteAll(id);
	}

}
